import Cookies from 'js-cookie'

const TokenKey = 'JPower_system_token'
const RefreshTokenKey = 'JPower_system_RToken'
const TenantCode = 'JPower_system_TenantCode'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  Cookies.remove(TokenKey)
  Cookies.remove(TenantCode)
  Cookies.remove(RefreshTokenKey)
  return
}

export function getRefreshToken() {
  return Cookies.get(RefreshTokenKey)
}

export function setRefreshToken(token) {
  return Cookies.set(RefreshTokenKey, token)
}

export function getTenantCode() {
  return Cookies.get(TenantCode)
}

export function setTenantCode(code) {
  return Cookies.set(TenantCode, code)
}
